/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!				\file		ErrDlg.h
				\date		june 2010
				\author		TNick

				\brief		Definition of the dialog used to display messages


    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please read ReadMe.txt and Licence.txt in root folder
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef		__ERRDLG_INC__
#define		__ERRDLG_INC__
#ifdef		__cplusplus
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<QtGui>
#include	<QDialog>

#include	<base/CC_Err.h>

/*  INCLUDES    ============================================================ */
//
//
//
//


/// application's class; only one class per running instance
/**
*
*/
class	ErrDlg : public QDialog	{
    Q_OBJECT


	//
	//
	//
	//
	/*  DEFINITIONS    --------------------------------------------------------- */

	enum	OPMODE		{
			OPMODE_NOINIT = 0, /**< default constructor was called; we can't
			tell the mode, yet*/

			OPMODE_SINGLE,		/**< we're displaying a single error */
			OPMODE_CHAIN,		/**< we're displaying a chain of errors */

			OPMODE_MAX			/**< for validation purpose */
		};
	
	/*  DEFINITIONS    ========================================================= */
	//
	//
	//
	//
	/*  DATA    ---------------------------------------------------------------- */

	/// if we're displaying a single error, this is it
private: CC_Err*		SingleErr;
	/// if we're displaying a chain of errors, this is it
private: QList<CC_Err*>*MultipleErr;
	/// this tells the mode that we're operating
private: OPMODE			opm;

	/// tell what kind of errors are shown
private: CCERR::ETYPE	AllowedTypes;
	/// text box for error messages
private: QTextEdit*		OutTx;

	/// array of checkboxes for types of errors that are shown
private: QCheckBox*		ckAry[CCERR::EIDX_COUNT];
	/// the button used to display / hide options
private: QToolButton*	ShHdBtn;
	/// tell at any time what state are the options
private: bool			bOptShown;


	/*  DATA    ================================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ----------------------------------------------------------- */

	/// the nice constructor
public:					ErrDlg		(QWidget *parent = 0);
public:					ErrDlg		(QList<CC_Err*> * pErrChain, QWidget *parent = 0);
public:					ErrDlg		(CC_Err * pOneErr, QWidget *parent = 0);
	/// the ugly destructor
public:	virtual			~ErrDlg		();

private: void			InternalInit			(void);
public:	void			ShowAError		(void);
public:	void			ShowChainError	(void);

private slots:
	void			ErrTypeChanged			(int state);
	void			DisplayTyChange			(void);


	/*  FUNCTIONS    =========================================================== */
	//
	//
	//
	//

};	/*	class	ErrDlg	*/
//
//
//
//
#endif	//	__cplusplus
#endif	//	__ERRDLG_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
